<?php
class Login_Model extends Model{
    function __construct(){
        parent::__construct();
    }
    public function run()
    {
        $check = $this->db->prepare("select id from users where  username = :username and password = MD5(:password)");
        $check->execute(array(
            ':username' => $_POST['username'],
            ':password' => $_POST['password']
        ));
        //$data = $check->fetchAll();
        $count = $check->rowCount();
        if($count>0){
            // login sucess
            Session::init();
            Session::set(loggedIn,true);
            header('location: ../dashboard');
        }
        else{
            //show eror
            header('location: ../login');
        }
    }
}